<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="usuario" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{usuarioHome.managed ? 'Edit' : 'Add'} Usuario</f:facet>



            <s:decorate id="usuApellidoField" template="layout/edit.xhtml">
                <ui:define name="label">Apellidos</ui:define>
                <h:inputText id="usuApellido"
                           size="50"
                      maxlength="50"
                      required="true"
                      requiredMessage="Ingrser los apellidos !!!"
                          value="#{usuarioHome.instance.usuApellido}">
                         
                         
                         
                    <a:support event="onblur" reRender="usuApellidoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>
<s:decorate id="usuNombreField" template="layout/edit.xhtml">
                <ui:define name="label">Nombres</ui:define>
                <h:inputText id="usuNombre"
                           size="50"
                      maxlength="50"
                      required="true"
                      requiredMessage="Ingrser los nombres !!!"
                          value="#{usuarioHome.instance.usuNombre}">
                    <a:support event="onblur" reRender="usuNombreField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>
            <s:decorate id="usuEmailField" template="layout/edit.xhtml">
                <ui:define name="label">Email</ui:define>
                <h:inputText id="usuEmail"
                           size="15"
                      maxlength="15"
                          value="#{usuarioHome.instance.usuEmail}">
                    <a:support event="onblur" reRender="usuEmailField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

<s:decorate id="usuUssuarioField" template="layout/edit.xhtml">
                <ui:define name="label">Usuario</ui:define>
                <h:inputText id="usuUssuario"
                           size="15"
                      maxlength="15"
                      required="true"
                      requiredMessage="Ingrser el nombre de usuario!!!"
                          value="#{usuarioHome.instance.usuUssuario}">
                    <a:support event="onblur" reRender="usuUssuarioField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <s:decorate id="usuClaveField" template="layout/edit.xhtml">
                <ui:define name="label">Clave</ui:define>
                <h:inputText id="usuClave"
                           size="15"
                      maxlength="15"
                       required="true"
                      requiredMessage="Ingrser la clave !!!"
                          value="#{usuarioHome.instance.usuClave}">
                    <a:support event="onblur" reRender="usuClaveField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>
            <s:decorate id="IdPerfil" template="layout/edit.xhtml">
     <ui:define name="label">Perfil</ui:define>
		<h:selectOneMenu value="#{usuarioHome.instance.tipoUsuario}"
converter="#{perfilListar.converter}"
requiredMessage="Seleccionar el perfil !!!"
required="true" 
	defaultLabel="Seleccione..." 
 				directInputSuggestions="true"
 				enableManualInput="false" 
>
 				
<f:selectItems value="#{perfilListar.allTipoUsuario}"  />
</h:selectOneMenu>
		  </s:decorate>
            <div style="clear:both">
                <span class="required">*</span>
                campos requeridos
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Guardar"
                         action="#{usuarioHome.persist}"
                       disabled="#{!usuarioHome.wired}"
                       rendered="#{!usuarioHome.managed}"/>

            <h:commandButton id="update"
                          value="Actualizar"
                         action="#{usuarioHome.update}"
                       rendered="#{usuarioHome.managed}"/>

            <h:commandButton id="delete"
                          value="Eliminar"
                         action="#{usuarioHome.remove}"
                      immediate="true"
                       rendered="#{usuarioHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancelar"
             propagation="end"
                    view="/Usuario.xhtml"
                rendered="#{usuarioHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancelar"
             propagation="end"
                    view="/#{empty usuarioFrom ? 'UsuarioList' : usuarioFrom}.xhtml"
                rendered="#{!usuarioHome.managed}"/>

        </div>
    </h:form>
</ui:define>

</ui:composition>
